<!--
  *********************物流项目三组************************
*  功能描述：货主合同管理
*  作者：郭辉
*  时间：2022-01-10
*  修改人：郭辉
*  修改时间：2022-01-10
*********************物流项目三组************************
-->

<template>
  <div>
    <!--货主合同添加-->
    <div>
      <el-dialog title="货主合同" :visible.sync="dialogFormVisible">
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="110px"
          class="demo-ruleForm"
        >
          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="合同标题" prop="Contract_Title">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForm.Contract_Title"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="货主单位" prop="Contract_Units">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForm.Contract_Units"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>
          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="货主负责人" prop="Contract_Name">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForm.Contract_Name"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="线路" prop="Contract_Line">
                  <el-select
                    v-model="ruleForm.Contract_Line"
                    placeholder="请选择活动区域"
                    tyle="width: 80%"
                  >
                    <el-option label="请选择" :value="0"></el-option>
                    <el-option label="线路1" :value="1"></el-option>
                    <el-option label="线路2" :value="2"></el-option>
                  </el-select>
                </el-form-item></div
            ></el-col>
          </el-row>

          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="吨运价" prop="Contract_Price">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForm.Contract_Price"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="包车条件吨位" prop="Contract_Chartered">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForm.Contract_Chartered"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>
          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="包车金额" prop="Contract_Money">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForm.Contract_balance"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="经办人" prop="Contract_AttentionLine">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForm.Contract_AttentionLine"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>

          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="签订时间" prop="Contract_Money">
                  <el-date-picker
                    type="date"
                    placeholder="选择日期"
                    v-model="ruleForm.Contract_CreateDate"
                    style="width: 80%"
                  ></el-date-picker>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="合同金额" prop="Contract_AttentionLine">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForm.Contract_Money"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>

          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="合同类型" prop="Contract_Type">
                  <el-radio v-model="ruleForm.Contract_Type" :label="1"
                    >货主合同</el-radio
                  >
                  <el-radio v-model="ruleForm.Contract_Type" :label="2"
                    >承运合同</el-radio
                  >
                  <el-radio v-model="ruleForm.Contract_Type" :label="3"
                    >通用合同</el-radio
                  >
                </el-form-item>
              </div></el-col
            >
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="合同类别" prop="Contract_Category">
                  <el-radio v-model="ruleForm.Contract_Category" :label="1"
                    >采购合同</el-radio
                  >
                  <el-radio v-model="ruleForm.Contract_Category" :label="2"
                    >财务类合同</el-radio
                  >
                  <el-radio v-model="ruleForm.Contract_Category" :label="3"
                    >合作协议</el-radio
                  >
                </el-form-item>
              </div></el-col
            >
          </el-row>

          <el-form-item label="合同标的或项目说明" prop="Contract_Description">
            <el-input
              type="textarea"
              v-model="ruleForm.Contract_Description"
            ></el-input>
          </el-form-item>
          <el-form-item label="合同主要条款/变更条款" prop="Contract_Terms">
            <el-input
              type="textarea"
              v-model="ruleForm.Contract_Terms"
            ></el-input>
          </el-form-item>
          <el-form-item label="合同文本（附件）" prop="desc">
            <el-upload
              class="upload-demo"
              action="https://jsonplaceholder.typicode.com/posts/"
              :on-preview="handlePreview"
              :on-remove="handleRemove"
              :before-remove="beforeRemove"
              multiple
              :limit="3"
              :on-exceed="handleExceed"
              :file-list="fileList"
            >
              <el-button size="small" type="primary">点击上传</el-button>
              <div slot="tip" class="el-upload__tip">
                （单个附件最大支持20M，支持：PDF、Word、Excel、Txt格式）
              </div>
            </el-upload>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="submitForm('ruleForm')"
              >提交审批</el-button
            >
            <el-button @click="resetForm('ruleForm')">取消</el-button>
          </el-form-item>
        </el-form>
      </el-dialog>
    </div>

    <!--货主合同编辑-->
    <div>
      <el-dialog title="货主合同" :visible.sync="dialogFormVisibles">
        <el-form
          :model="ruleForms"
          :rules="rules"
          ref="ruleForms"
          label-width="110px"
          class="demo-ruleForm"
        >
          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="合同标题" prop="Contract_Title">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Title"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="货主单位" prop="Contract_Units">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Units"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>
          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="货主负责人" prop="Contract_Name">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Name"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="线路" prop="Contract_Line">
                  <el-select
                    v-model="ruleForms.Contract_Line"
                    placeholder="请选择活动区域"
                    tyle="width: 80%"
                  >
                    <el-option label="请选择" :value="0"></el-option>
                    <el-option label="线路1" :value="1"></el-option>
                    <el-option label="线路2" :value="2"></el-option>
                  </el-select>
                </el-form-item></div
            ></el-col>
          </el-row>

          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="吨运价" prop="Contract_Price">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Price"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="包车条件吨位" prop="Contract_Chartered">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Chartered"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>
          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="包车金额" prop="Contract_Money">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_balance"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="经办人" prop="Contract_AttentionLine">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_AttentionLine"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>

          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="签订时间" prop="Contract_Money">
                  <el-date-picker
                    type="date"
                    placeholder="选择日期"
                    v-model="ruleForms.Contract_CreateDate"
                    style="width: 80%"
                  ></el-date-picker>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="合同金额" prop="Contract_AttentionLine">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Money"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>

          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="合同类型" prop="Contract_Type">
                  <el-radio v-model="ruleForms.Contract_Type" :label="1"
                    >货主合同</el-radio
                  >
                  <el-radio v-model="ruleForms.Contract_Type" :label="2"
                    >承运合同</el-radio
                  >
                  <el-radio v-model="ruleForms.Contract_Type" :label="3"
                    >通用合同</el-radio
                  >
                </el-form-item>
              </div></el-col
            >
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="合同类别" prop="Contract_Category">
                  <el-radio v-model="ruleForms.Contract_Category" :label="1"
                    >采购合同</el-radio
                  >
                  <el-radio v-model="ruleForms.Contract_Category" :label="2"
                    >财务类合同</el-radio
                  >
                  <el-radio v-model="ruleForms.Contract_Category" :label="3"
                    >合作协议</el-radio
                  >
                </el-form-item>
              </div></el-col
            >
          </el-row>

          <el-form-item label="合同标的或项目说明" prop="Contract_Description">
            <el-input
              type="textarea"
              v-model="ruleForms.Contract_Description"
            ></el-input>
          </el-form-item>
          <el-form-item label="合同主要条款/变更条款" prop="Contract_Terms">
            <el-input
              type="textarea"
              v-model="ruleForms.Contract_Terms"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="upds">保存</el-button>
            <el-button @click="resetForm('ruleForm')">取消</el-button>
          </el-form-item>
        </el-form>
      </el-dialog>
    </div>

    <!--货主合同查看-->
    <div>
      <el-dialog title="承运合同" :visible.sync="dialogFormVisibled">
        <el-form
          :model="ruleForms"
          :rules="rules"
          ref="ruleForms"
          label-width="110px"
          class="demo-ruleForm"
        >
          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="合同标题" prop="Contract_Title">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Title"
                    readonly="readonly"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="货主单位" prop="Contract_Units">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Units"
                    readonly="readonly"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>
          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="货主负责人" prop="Contract_Name">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Name"
                    readonly="readonly"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="线路" prop="Contract_Line">
                  <el-select
                    v-model="ruleForms.Contract_Line"
                    placeholder="请选择活动区域"
                    tyle="width: 80%"
                    readonly="readonly"
                  >
                    <el-option label="请选择" :value="0"></el-option>
                    <el-option label="线路1" :value="1"></el-option>
                    <el-option label="线路2" :value="2"></el-option>
                  </el-select>
                </el-form-item></div
            ></el-col>
          </el-row>

          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="吨运价" prop="Contract_Price">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Price"
                    readonly="readonly"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="包车条件吨位" prop="Contract_Chartered">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Chartered"
                    readonly="readonly"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>
          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="包车金额" prop="Contract_Money">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_balance"
                    readonly="readonly"
                  ></el-input>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="经办人" prop="Contract_AttentionLine">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_AttentionLine"
                    readonly="readonly"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>

          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="签订时间" prop="Contract_Money">
                  <el-date-picker
                    type="date"
                    placeholder="选择日期"
                    v-model="ruleForms.Contract_CreateDate"
                    style="width: 80%"
                    readonly="readonly"
                  ></el-date-picker>
                </el-form-item></div
            ></el-col>
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="合同金额" prop="Contract_AttentionLine">
                  <el-input
                    style="width: 80%"
                    v-model="ruleForms.Contract_Money"
                    readonly="readonly"
                  ></el-input>
                </el-form-item></div
            ></el-col>
          </el-row>

          <el-row>
            <el-col :span="12"
              ><div class="grid-content bg-purple">
                <el-form-item label="合同类型" prop="Contract_Type">
                  <el-radio v-model="ruleForms.Contract_Type" :label="1"
                    >货主合同</el-radio
                  >
                  <el-radio v-model="ruleForms.Contract_Type" :label="2"
                    >承运合同</el-radio
                  >
                  <el-radio v-model="ruleForms.Contract_Type" :label="3"
                    >通用合同</el-radio
                  >
                </el-form-item>
              </div></el-col
            >
            <el-col :span="12"
              ><div class="grid-content bg-purple-light">
                <el-form-item label="合同类别" prop="Contract_Category">
                  <el-radio v-model="ruleForms.Contract_Category" :label="1"
                    >采购合同</el-radio
                  >
                  <el-radio v-model="ruleForms.Contract_Category" :label="2"
                    >财务类合同</el-radio
                  >
                  <el-radio v-model="ruleForms.Contract_Category" :label="3"
                    >合作协议</el-radio
                  >
                </el-form-item>
              </div></el-col
            >
          </el-row>

          <el-form-item label="合同标的或项目说明" prop="Contract_Description">
            <el-input
              type="textarea"
              v-model="ruleForms.Contract_Description"
            ></el-input>
          </el-form-item>
          <el-form-item label="合同主要条款/变更条款" prop="Contract_Terms">
            <el-input
              type="textarea"
              v-model="ruleForms.Contract_Terms"
            ></el-input>
          </el-form-item>
        </el-form>
      </el-dialog>
    </div>

    <el-row :gutter="20">
      <el-col :span="4"
        ><div class="grid-content bg-purple">
          合同名称：<el-input
            v-model="ContractsTitle"
            placeholder="请输入内容"
            style="width: 70%"
          ></el-input></div
      ></el-col>
      <el-col :span="4"
        ><div class="grid-content bg-purple">
          货主单位：<el-input
            v-model="ContractUnits"
            placeholder="请输入内容"
            style="width: 70%"
          ></el-input></div
      ></el-col>
      <el-col :span="4"
        ><div class="grid-content bg-purple">
          货主负责人：<el-input
            v-model="ContractName"
            placeholder="请输入内容"
            style="width: 67%"
          ></el-input></div
      ></el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="4"
        ><div class="grid-content bg-purple">
          经办人：<el-input
            v-model="ContractAttentionLine"
            placeholder="请输入内容"
            style="width: 70%"
          ></el-input></div
      ></el-col>
      <el-col :span="4"
        ><div class="grid-content bg-purple">
          签订时间：<el-date-picker
            v-model="ContractCreateDate"
            type="date"
            placeholder="选择日期"
            style="width: 70%"
          >
          </el-date-picker></div
      ></el-col>
      <el-col :span="4"
        ><div class="grid-content bg-purple">
          审批状态：
          <el-select v-model="ContractState" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select></div
      ></el-col>
      <el-col :span="4"
        ><div class="grid-content bg-purple">
          <el-button type="primary" icon="el-icon-search" @click="show"
            >查询</el-button
          >
          <el-button class="el-icon-back">重置</el-button>
        </div></el-col
      >
    </el-row>

    <el-button type="primary" @click="kai">新增</el-button>
    <el-button type="primary" @click="dels">删除</el-button>

    <el-table
      :data="tableData"
      stripe
      style="width: 100%"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55"> </el-table-column>
      
      <el-table-column prop="Contract_Title" label="合同标题" width="100">
      </el-table-column>
      <el-table-column prop="Contract_Units" label="货主单位" width="100">
      </el-table-column>
      <el-table-column prop="Contract_Name" label="货主负责人" width="100">
      </el-table-column>
      <el-table-column prop="Contract_Line" label="线路" width="100">
        <template slot-scope="scope">
          <span v-show="scope.row.Contract_Line == 1">线路1</span>
          <span v-show="scope.row.Contract_Line == 2">线路2</span>
        </template>
      </el-table-column>
      <el-table-column prop="Contract_Price" label="吨位价" width="100">
      </el-table-column>
      <el-table-column
        prop="Contract_Chartered"
        label="包车条件吨位"
        width="120"
      >
      </el-table-column>
      <el-table-column prop="Contract_balance" label="包车金额" width="100">
      </el-table-column>
      <el-table-column prop="Contract_CreateDate" label="签订日期" width="100">
      </el-table-column>
      <el-table-column prop="Contract_AttentionLine" label="经办人" width="100">
      </el-table-column>
      <el-table-column prop="CreateDate" label="创建日期" width="100">
      </el-table-column>
      <el-table-column prop="Contract_State" label="状态" width="100">
        <template slot-scope="scope">
          <span v-show="scope.row.Contract_State == 1">待提交</span>
          <span v-show="scope.row.Contract_State == 2">待审批</span>
          <span v-show="scope.row.Contract_State == 3">已拒绝</span>
          <span v-show="scope.row.Contract_State == 4">已通过</span>
        </template>
      </el-table-column>
      <el-table-column prop="-" label="审批人" width="100"> </el-table-column>
      <el-table-column label="操作" fixed="right" width="310">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button
          >
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)"
            >删除</el-button
          >
          <el-button
            size="mini"
            type="success"
            @click="eidt(scope.$index, scope.row)"
            >查看</el-button
          >
          <span v-show="(scope.row.Contract_State == 1)">
            <el-button
              size="mini"
              type="primary"
              @click="handleEdit(scope.$index, scope.row)"
              >提假审批</el-button
            >
          </span>
          <span v-show="(scope.row.Contract_State == 2)"> </span>
          <span v-show="(scope.row.Contract_State ==3)">
            <el-button
              size="mini"
              type="primary"
              @click="handleEdit(scope.$index, scope.row)"
              >重新审批</el-button
            >
          </span>
          <span v-show="(scope.row.Contract_State == 4)"> </span>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageindex"
      :page-sizes="[3, 5, 10, 15]"
      :page-size="pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="totalcount"
      style="text-align: center"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fileList: [],
      options: [
        {
          value: 0,
          label: "请选择",
        },
        {
          value: 1,
          label: "待提交",
        },
        {
          value: 2,
          label: "待审批",
        },
        {
          value: 3,
          label: "已拒绝",
        },
        {
          value: 4,
          label: "已通过",
        },
      ],
      value: "",
      input: "",
      value1: "",
      tableData: [],
      multipleSelection: [],
      pageindex: 1,
      pagesize: 5,
      totalcount: 0,
      ContractsTitle: "",
      ContractUnits: "",
      ContractName: "",
      ContractAttentionLine: "",
      ContractCreateDate: "",
      ContractState: 0,
      dialogFormVisible: false,
      formLabelWidth: "120px",
      ruleForm: {
        Contract_Type: 1,
        PeopleId: "29fbc795-aa87-4414-bb0c-3f405ebcc3c1",
      },
      ruleForms: {},
      ids: [],
      rules: {
        Contract_Title: [
          { required: true, message: "请输入标题", trigger: "blur" },
        ],
        Contract_Name: [
          { required: true, message: "请输入货主负责人", trigger: "change" },
        ],
        Contract_Units: [
          { required: true, message: "请输入货主单位", trigger: "change" },
        ],
        Contract_Price: [
          { required: true, message: "请输入吨运价", trigger: "change" },
        ],
        Contract_Chartered: [
          { required: true, message: "请输入包车条件吨位", trigger: "change" },
        ],
        Contract_balance: [
          { required: true, message: "请输入包车金额", trigger: "change" },
        ],
        Contract_AttentionLine: [
          { required: true, message: "请输入经办人", trigger: "change" },
        ],
      },
      dialogFormVisibles: false,
      dialogFormVisibled: false,
    };
  },
  methods: {
    handleSizeChange(val) {
      this.pagesize = val;
      this.show();
    },
    handleCurrentChange(val) {
      this.pageindex = val;
      this.show();
    },
    kai() {
      this.dialogFormVisible = true;
    },
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.$axios
            .post(
              "https://localhost:44360/api/app/t-mS_Contract/contracts",
              this.ruleForm
            )
            .then((res) => {
              if (res.data == 1) {
                alert("添加成功!");
                this.dialogFormVisible = false;
                this.show();
              } else {
                alert("添加失败!");
              }
            });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
    show() {
      this.$axios
        .get(
          "https://localhost:44360/api/app/t-mS_Contract/contracts?ContractsTitle=" +
            this.ContractsTitle +
            "&ContractUnits=" +
            this.ContractUnits +
            "&ContractName=" +
            this.ContractName +
            "&ContractAttentionLine=" +
            this.ContractAttentionLine +
            "&ContractCreateDate=" +
            this.ContractCreateDate +
            "&ContractState=" +
            this.ContractState +
            "&pageindex=" +
            this.pageindex +
            "&pagesize=" +
            this.pagesize +
            ""
        )
        .then((res) => {
          this.tableData = res.data.PageData;
          this.totalcount = res.data.PageTotal;
        });
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
      // for (index = 1; i <= this.multipleSelection.length; index++) {
      //   this.ids.push(this.multipleSelection[index].Contract_Id);
      // }
    },
    handleEdit(index, row) {
      this.dialogFormVisibles = true;
      this.ruleForms = row;
    },
    eidt(index, row) {
      this.dialogFormVisibled = true;
      this.ruleForms = row;
    },
    upds() {
      this.$axios
        .put(
          "https://localhost:44360/api/app/t-mS_Contract/person-names",
          this.ruleForms
        )
        .then((res) => {
          if (res.data == 1) {
            alert("修改成功!");
            this.dialogFormVisibles = false;
            this.show();
          } else {
            alert("修改失败!");
            this.dialogFormVisibles = false;
          }
        });
    },
    dels() {
      this.ids = this.multipleSelection.map((item) => item.Contract_Id).join();
      if (confirm("确定要删除选中的数据吗?")) {
        this.$axios
          .delete(
            "https://localhost:44360/api/app/t-mS_Contract/s-contracts?ids=" +
              this.ids
          )
          .then((res) => {
            if (res.data == 1) {
              alert("删除成功!");
              this.show();
            }
          });
      }
    },
    handleDelete(index, row) {
      if (confirm("确定删除此条数据吗?")) {
        this.$axios
          .delete(
            "https://localhost:44360/api/app/t-mS_Contract/" +
              row.Contract_Id +
              "/contracts"
          )
          .then((res) => {
            if (res.data == 1) {
              alert("删除成功!");
              this.show();
            }
          });
      }
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    },
    handleExceed(files, fileList) {
      this.$message.warning(
        `当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${
          files.length + fileList.length
        } 个文件`
      );
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
  },
  created() {
    this.show();
  },
};
</script>

<style>
</style>